//
//  Tool.h
//  oschina
//
//  Created by wangjun on 12-3-13.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface Tool : NSObject

+ (BOOL)isContainsEmoji:(NSString *)string;

+ (void)setCache:(NSString *)key value:(id)value;

+ (NSString *)getCache:(NSString *)key;
+ (void)removeCache:(NSString *)key;
/**
 *  存入文件
 *
 *  @param key     key
 *  @param content 内容
 */
+ (void)setFileCache:(NSString *)key value:(id)content;
/**
 *  取出文件
 *
 *  @param key key
 *
 *  @return 内容
 */
+ (id)getFileCache:(NSString *)key;

+ (NSString *)setFileDocumentPath:(NSString *)key;

+ (NSString *)getMd5_32Bit_String:( NSString *)srcString;

+ (BOOL)isBlankString:(NSString *)string;

+ (int)getCnCharNum:(NSString *)value;

+ (BOOL)validateMobile:(NSString *)mobile;

+ (int)getRandomNumber:(int)from to:(int)to;

+ (int)textLength:(NSString *)text;

+ (CGSize)getSizeWithString:(NSString *)string font:(UIFont *)font;

+ (CGSize)getSizeWithString:(NSString *)string font:(UIFont *)font blanksize:(float)blanksize;
/**
 *  计算高度
 *
 *  @param string 文字
 *  @param font   字体
 *  @param width  宽度
 *
 *  @return 高度
 */
+ (CGSize)getSizeWithString:(NSString *)string font:(UIFont *)font withWidth:(CGFloat)width;
/**
 *  计算宽度
 *
 *  @param string 文字
 *  @param font   字体
 *  @param height 高度
 *
 *  @return 宽度
 */
+ (CGSize)getSizeWithString:(NSString *)string font:(UIFont *)font withHeight:(CGFloat)height;

//得到中英文混合字符串长度
+ (NSInteger)getToInt:(NSString*)strtemp;

+ (NSDictionary *)getDicFromJson:(id)json;

+ (NSArray *)getArrayFromJson:(id)json;

+ (NSString *)getStringFromJson:(id)json;

//+ (void)showTextHUD:(NSString *)text andView:(UIView *)view labelTextColor:(UIColor *)labelTextColor;

//system save
+ (void)saveObjectToSystem:(id)object forKey:(NSString*)key;

+ (id)getObjectFromSystemWithKey:(NSString*)key;

+ (NSString *)getFileMd5:(NSString *)path;

+ (NSDictionary *)getParmsFromUrl:(NSURL *)url;

+ (NSString *)getCurrentVersion;
/**
 *  禁止iCloud备份，用于向document存储东西时使用
 *
 *  @param URL 存储URL
 *
 *  @return 成功与否
 */
+ (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;

/**
 *  解码base64
 *
 *  @param string 文字
 */
//+ (NSString *)decodeBase64String:(NSString *)input;
/**
 *  编码64
 *
 *  @param input 文字
 */
//+ (NSString *)encodeBase64String:(NSString *)input;
/**
 *  验证一段文字是否都为数字
 *
 *  @param string 文字
 *
 *  @return YES / NO
 */
+ (BOOL)isAllNumberString:(NSString *)string;
/**
 *  验证手机号码
 *
 *  @param mobileNum 手机号
 *
 *  @return 是否为正确的
 */
+ (BOOL)isMobileNumber:(NSString *)mobileNum;
/**
 *  截屏成为图片
 *
 *  @return 返回图片
 */
+ (UIImage *)snapshot;

/**
 *  验证字符串为空值
 *
 *  @return YES / NO
 */
+ (BOOL)validateStringIsEmpty:(NSString *)str;
@end
